<template>
    <div>
        <h1>科室列表</h1>
        科室名称:
        <input type="text" v-model="info.departmentname">
        <input type="button" value="查询" @click="show">
        <table class="table table-bordered">
           <tbody>
             <tr>
               <td>科室名称</td>
               <td>科室图片</td>
               <td>成立日期</td>
            </tr>
            <tr v-for="item in list" :key="item.id">
               <td>{{item.departmentName}}</td>
               <td><img :src="item.photo" width="100" height="100"></td>
               <td>{{item.startTime.substring(0,10)}}</td>
            </tr>
           </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted} from "vue";
import axios from "axios";
import moment from "moment";
import {useRouter,useRoute} from "vue-router";
const router=useRouter();
const route=useRoute();
onMounted(()=>
{
    show();
})
let info:any=reactive({
  "departmentname": ""
})
let list:any=ref([]);
const show=()=>
{
    
    axios({
        url:'http://localhost:5182/api/Money/ShowDepartment',
        method:'get',
        params:info
    })
    .then((res)=>
    {
        console.log(res);
        list.value=res.data;
    })
    .catch((err)=>
    {
        console.log(err);
    })
}

</script>

<style scoped>

</style>